﻿using System.IO;
using System;
using System.Diagnostics;

namespace DawnTools
{
    class UGitCMD
    {
        public static string Add(string path,string commit)
        {
            Cmd cmd = new Cmd();
            cmd.RunCmd("cd XXXXX".Replace("XXXXX",path));
            cmd.RunCmd("git add .");
            return cmd.RunCmd("git commit -m\"XXXXX\"".Replace("XXXXX",commit));
        }
        public static string SetUserName(string name)
        {
            Cmd cmd = new Cmd();
            return cmd.RunCmd(("git config --global user.name \"XXXXX\"").Replace("XXXXX",name));
        }
        public static string SetUserEmail(string email)
        {
            Cmd cmd = new Cmd();
            return cmd.RunCmd(("git config --global user.email XXXXX").Replace("XXXXX", email));
        }
        public static string Init(string path)
        {
            Cmd cmd = new Cmd();
            cmd.RunCmd(("cd XXXXX").Replace("XXXXX", path));
            return cmd.RunCmd(("git init"));
        }
        public static string Clone(string local,string net)
        {
            Cmd cmd = new Cmd();
            cmd.RunCmd(("cd XXXXX").Replace("XXXXX", local));
            return cmd.RunCmd(("git clone XXXXX").Replace("XXXXX", net));
        }
        public static string Pull(string path)
        {
            Cmd cmd = new Cmd();
            cmd.RunCmd("cd XXXXX".Replace("XXXXX",path));
            return cmd.RunCmd("git pull");
        }

        public static string Push(string path)
        {
            Cmd cmd = new Cmd();
            cmd.RunCmd("cd XXXXX".Replace("XXXXX",path));
            return cmd.RunCmd("git push");
        }
        public static string AddPath(string path)
        {
            Cmd cmd = new Cmd();
            return cmd.RunCmd("git remote add origin \"XXXXX\"".Replace("XXXXX", path));
        }
        public static string SetPath(string path)
        {
            return new Cmd().RunCmd("git remote set-url origin XXXXX".Replace("XXXXX", path));
        }
        public static string GetWinUserName()
        {
            return Environment.UserName;
        }
    }


 

    
}
